<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
     <meta content="telephone=no" name="format-detection" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable = no"/>
    <title>订单列表-{$webseting.web_title}</title>
    <link href="__PUBLIC__/wap/css/rest.css"  rel="stylesheet">
    <link href="__PUBLIC__/wap/css/user.css"  rel="stylesheet">
</head>
<body id="body">
    <header id="header" class="u-header clearfix">
        <div class="u-hd-left f-left">
            <a href="{:U('wap/member/index')}" class="J_backToPrev"><span class="u-icon-px i-hd-back"></span></a>
        </div>
        <div class="u-hd-tit"><span>订单列表</span></div>
    </header>
    <div class="common-wrapper">
          <div>
        <ul class="padding-list current-half-width oder_state_c">
            <li data="all" class="curr">
                <a href="javascript:void(0);">
                    <p>{$count}</p>
                    <p>全部</p>
                </a>
            </li>
            <li data="10">
                <a href="javascript:void(0);">
                    <p>{$count10}</p>
                    <p>待付款</p>
                </a>
            </li>
            <li data="20">
                <a href="javascript:void(0);">
                    <p>{$count20}</p>
                    <p>已付款</p>
                </a>
            </li>
            <li data="30">
                <a href="javascript:void(0);">
                    <p>{$count30}</p>
                    <p>已完成</p>
                </a>
            </li>
        </ul>
    </div>
        <div class="f-nei">
            <ul class="concern-con initHeight more_html">
               <volist name="list" id="vo">
                <li>
                    <a class="" href="{:U('wap/order/order_detail',array('id'=>$vo['order_id']))}">
                        
                        <span class="p-name">订单编号：{$vo.pay_sn} 【{$vo.order_state_name}】</span>
                        <span class="p-price">
                            <span>￥{$vo.order_amount}/<s style="text-decoration: line-through; color:#999;">￥{$vo.goods_amount}</s></span>
                        </span>
                    </a>
                    <a class="btn-grey" style="right: 7.625em;">{$vo.add_time}</a>
                    <if condition="$vo.order_state eq '10'">
                        <a href="{:U('wap/order/order_pay',array('pay_sn'=>$vo['pay_sn']))}" class="btn-grey">去付款</a>
                    <else/>
                        <a class="btn-grey">{$vo.order_state_name}</a>
                    </if>
                </li>
               </volist>
            </ul>
        </div>

    </div>
         <div class="b_q">
        <div class="fm-footer-copyright get_more">
            <if condition="$count gt 10 && count($list) eq 10">
                  加载更多
              <else/>  
                 无更多数据
            </if>
        </div>
    </div>
  <div style="height:50px;">
   </div> 
     <!--end top-->
   <include file="Public/footer" />  
     <!--end top-->
     
     <input type="hidden" name="p" value="2" />
     <input type="hidden" name="order_state" value="all" /> 
     
    <script src="__PUBLIC__/bootstrap/vendor/jquery/jquery.min.js"></script> 
 <script type="text/javascript">
   $(function(){
     $(".get_more").click(function(){
        get_more();
     });
     $(".oder_state_c li").click(function(){
        
        $('.oder_state_c li').removeClass('curr');
        $(this).addClass('curr');
        var data=$(this).attr('data');
        $("input[name='order_state']").val(data);
        $("input[name='p']").val(1);
        get_more();
     });
     
   }); 
   function get_more(){
     var p=$("input[name='p']").val();
      var order_sta=$("input[name='order_state']").val();
           $.ajax({ 
            url: "{:U('wap/order/index')}",
            type:'post',
            data: {p:p,order_state:order_sta},
            dataType: 'json',
            success: function(data){
              //console.log(data);
               var con=1;
                var option='';
                if(data){
                      $.each(data, function(i, value) {
                    //this指向当前元素
                    //i表示Array当前下标
                    //value表示Array当前元素
                    var order_state="";
                    if(value.order_state=="10"){
                      order_state='<a href="<?php echo U('wap/order/order_pay'); ?>?pay_sn='+value.pay_sn+'" class="btn-grey">去付款</a>';
                    }else{
                      order_state='<a class="btn-grey">'+value.order_state_name+'</a>';
                    }
                     option=option+' <li>'
                  +'      <a class="" href="<?php echo U('wap/order/order_detail'); ?>?id='+value.order_id+'">'
                  +'             <span class="p-name">订单编号：'+value.pay_sn+' 【'+value.order_state_name+'】</span>'
                  +'              <span class="p-price">'
                  +'                 <span>￥'+value.order_amount+'/<s style="text-decoration: line-through;  color:#999;">￥'+value.goods_amount+'</s></span>'
                  +'               </span>'
                  +'          </a>'
                  +'           <a class="btn-grey" style="right: 7.625em;">'+value.add_time+'</a>'
                  +        order_state
                  +'      </li>';
                        con++;
                     });
                }
                 
                if(p==1){
                  $('.more_html').html(option);
                }else{
                  $('.more_html').append(option);
                }
                 
                 $("input[name='p']").val(parseInt(p)+1);
            
              if(con<10){
                 $('.get_more').html('无更多数据');
              }
            }
           });
   }
</script>   
</body>
</html>